import urllib.request

"""
req = urllib.request.Request('http://placekitten.com/g/300/200')
response = urllib.request.urlopen(req)
"""
response = urllib.request.urlopen('http://placekitten.com/g/300/200')
cat_img = response.read()

# 保存图片
with open('cat_300_200.jpg', 'wb') as file:
    file.write(cat_img)

# 打印请求路径
print(response.geturl())
# 打印响应信息
print(response.info())
# 打印状态码
print(response.getcode())
